﻿using System;
using System.Data.Entity.Migrations;
using System.Linq;
using Repository.EF;
using Repository.Repositories.Interfaces;

namespace Repository.Repositories.EFRepository
{
    public class EmpRepository : IEmpRepository
    {
        private readonly UseeInfoTBEntities ctx = new UseeInfoTBEntities();

        public Emp FirstOrDefault(Func<Emp, bool> exp)
        {
            return ctx.Emp.FirstOrDefault(exp);
        }

        public void Persist(Emp emp)
        {
            ctx.Emp.AddOrUpdate(emp);
            ctx.SaveChanges();
        }
    }
}
